<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>CusCompensation</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../layui-v2.6.8/layui/css/layui.css"  media="all">
    <script type="text/javascript" src="../../layui-v2.6.8/layui/layui.js"></script>
</head>
<body>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend>申请赔偿</legend>
</fieldset>
<form class="layui-form">
    <div class="layui-form-item">
        <label class="layui-form-label">订单编号</label>
        <div class="layui-input-block">
            <input type="text" name="com_oid" required  lay-verify="required" placeholder="订单编号" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">赔偿费用</label>
        <div class="layui-input-block">
            <input type="text" name="com_pay" required  lay-verify="required" placeholder="元" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">赔偿原因</label>
        <div class="layui-input-block">
            <textarea name="cause" placeholder="" class="layui-textarea"></textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
<script>
    layui.use(['form','layer'],function(){
        var form = layui.form;
        var $ = layui.$;
        var layer = layui.layer;

        //订单提交
        form.on('submit(formDemo)', function(data){
            $.ajax({
                url:'http://localhost:8080/addcom',
                async: true,
                type : 'get',
                dataType: 'json',
                data: data.field,
                success: function (data) {
                    if (data.code === 0) {
                        layer.msg("申请成功");
                        setTimeout('location.reload()','1000');
                    } else {
                        layer.msg("申请失败");
                    }
                }
            });
            return false;
        });

    });

</script>

</body>
</html>